<!doctype html>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/modules/cms/front/include/taglib.jsp"%>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>山东省林业厅</title>
    <meta name="description" content="">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="${ctxStatic}/sdlyfp/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="${ctxStatic}/sdlyfp/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="${ctxStatic}/sdlyfp/css/amazeui.min.css" />
    <link rel="stylesheet" href="${ctxStatic}/sdlyfp/css/admin.css">
    <link rel="stylesheet" href="${ctxStatic}/sdlyfp/css/app.css">
    <script src="${ctxStatic}/sdlyfp/js/echarts.min.js"></script>
</head>

<body data-type="index">
    
<!-- head -->
<jsp:include page="../basic/head.jsp" flush="false"></jsp:include>

<div class="tpl-page-container tpl-page-header-fixed">
   
<!-- 菜单 -->
<jsp:include page="../basic/menu.jsp" flush="false"></jsp:include>

<div class="tpl-content-wrapper">
  <div class="tpl-content-page-title">
        ${title }数据导入
     	&nbsp;<font style="font-size: 17px;" color="red"><b>温馨提示：
     	</br>1,导入前，请先下载模板，务必按照模板格式填写数据，导入前请确认您的输入正确;图片和文件无法导入，只能导入数据后自行添加。
	  	</br>2,请勿重复导入，否则会导致数据统计错误；每次导入量建议不要超过6000条。
	  	</br>3,每个管理员只能导入本账号所在区域下的所有下级区域的相关扶贫数据</b></font>
  </div>
            
  <div class="row">
      <div class="am-u-md-6 am-u-sm-12 row-mb" style="display:none">
          <div class="tpl-portlet">
              <div class="tpl-portlet-title">
                  <div class="tpl-caption font-green ">
                      <i class="am-icon-cloud-download"></i>
                      <span> ${title }数据导入</span>
                  </div>
              </div>

            </div>
        </div>

        
<div  class="am-u-md-12 am-u-sm-12 row-mb"  >
<div class="tpl-portlet">
	<div class="tpl-portlet-title">
	       <div class="tpl-caption font-red ">
	            <i class="am-icon-bar-chart"></i>
	           <span>${title }数据导入</span>
	           <span id="tip" style="margin-left: 200px;display: none;">
					<img style="width: 35px;height: 35px;" src="${ctxStatic }/sdlyfp/img/loading.gif">
					<font color="red"><b>正在导入，请耐心等待...</b></font>
				</span>
	       </div>
	</div>
	<style>.hdm{ margin-bottom:5px}</style>
	
	<form id="fileForm" method="post" action="${ctx}/gt/gtDownLoad/import" enctype="multipart/form-data">
		<input type="hidden" id="type" name="type" value="${type }">
		<div style="margin-left: 100px;">
			</br></br>
			<font size="3">请选择${title }导入文件：</font>
			<input type="file" id="batchFile" name="batchFile">
			</br>
			</br>
			<input type="button" onclick="downLoad();" class="am-topbar-btn am-btn am-btn-sm am-btn-success" value = "模板下载">
			<input type="button" onclick="upLoad();" class="am-topbar-btn am-btn am-btn-sm am-btn-success" value = "开始导入">
	    
		</div>
	</form>
	
	
</div>
</div>
</div>

 </div>
</div> 

</div> 

    <script src="${ctxStatic}/sdlyfp/js/jquery.min.js"></script>
    <script src="${ctxStatic}/sdlyfp/js/amazeui.min.js"></script>
    <script src="${ctxStatic}/sdlyfp/js/iscroll.js"></script>
    <script src="${ctxStatic}/sdlyfp/js/app.js"></script>
	<script>
	
	$(function(){
		// $(".tpl-left-nav-menu").find("li a").eq(0).addClass("active");
		
	var menuId = '${menuId }';
	if(menuId)
	{
		$(".tpl-left-nav-menu").find("#"+menuId).addClass("active");
	}
		
	})
	
	var message = "${message}";
	if(message)
	{
		var messageType = "${messageType}";
		msg(message,null,messageType);
	}
	
	function upLoad()
	{
		var batchFile = $("#batchFile").val();
		if(!batchFile)
		{
			msg("您还没有选择文件，请先选择文件。",3000,"warning");
			return;
		}
		if(batchFile.indexOf(".") < 0 || batchFile.split(".")[1] != "xlsx")
		{
			msg("您选择的文件格式错误，文件以下载的模板为准。",3000,"warning");
			return;
		}
		
		comfirmMsg("请确认您模板中的数据格式和内容正确，确认要导入吗？",sub,"","","已确认","我再确认一下");
				
		function sub()
		{
			$("#tip").show();
			document.forms[0].submit();
		}
	}
	
	function importExcel(url)
	{
		// $(".hdm").parent().attr("disabled",true);
		
		$("#tip").show();
		var timeStamp = new Date().getTime();
		$("#downloadIframe").attr("src",url + "?timeStamp=" + timeStamp)
		
		var interVal = setInterval(function(){
			var downToken = getCookie('downToken');
			if(downToken == timeStamp)
			{
				clearInterval(interVal);
				$("#tip").hide();
				
				// $(".hdm").parent().attr("disabled",false);
			}
		},200);	
	}
	
	function downLoad()
	{
		$("#downloadIframe")[0].src="${ctx}/gt/gtDownLoad/downLoadTemplate?type=${type}";	
	}
	
	</script>
	<iframe id="downloadIframe" src="" style="display:none;" />
</body>
</html>